<template>
	<view>
		<u-button
			type="primary"
			@click="
				onLook(
					'https://fctest.nebuladata.cn/api/img/73/20220223/%E8%AE%BE%E5%A4%87%E6%A0%87%E5%87%86%E4%B9%A6.doc'
				)
			"
			>查看word</u-button
		><u-gap height="16"></u-gap>
		<u-button
			type="primary"
			@click="
				onLook(
					'https://fctest.nebuladata.cn/api/img/73/20220223/%E8%AE%BE%E5%A4%87%E5%AE%89%E5%85%A8%E6%96%87%E4%BB%B6.xlsx'
				)
			"
			>查看excel</u-button
		><u-gap height="16"></u-gap>
		<u-button
			type="primary"
			@click="
				onLook(
					'https://fctest.nebuladata.cn/api/img/73/20220223/%E8%AE%BE%E5%A4%87%E6%A0%87%E5%87%86%E4%B9%A6.pdf'
				)
			"
			>查看pdf</u-button
		>
	</view>
</template>

<script>
export default {
	data() {
		return {};
	},
	methods: {
		onLook(url) {
			uni.downloadFile({
				url,
				success: function (res) {
					var filePath = res.tempFilePath;
					uni.openDocument({
						filePath: filePath,
						showMenu: true,
						success: function (res) {
							console.log("打开文档成功");
						},
					});
				},
			});
		},
	},
};
</script>

<style></style>
